import React from 'react';
import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogContentText from '@material-ui/core/DialogContentText';
import DialogTitle from '@material-ui/core/DialogTitle';
import Grid from '@material-ui/core/Grid';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { withStyles } from '@material-ui/core/styles';
import Radio from '@material-ui/core/Radio';
import CardContent from '@material-ui/core/CardContent';
import Card from '@material-ui/core/Card';
import { TextField } from '@material-ui/core';
import { Table, Menu, Icon, Switch } from 'antd';
import { columns } from "./SynDataDialog/Components"

// import { Menu, Icon, Switch } from 'antd';
import {
  FetchmeetPreparefindAgendaTree,
  FetchmeetPreparegetAgendaPersonList,
  FetchmeetPreparegetCongressPersonList,
  FetchgetStaffInfoListpeople,
  FetchaddCongressPersonsListtarge,
  FetchaddAgendaPersonsListtarge,
  FetchdeleteAgendaPersonstarge,
  FetchdeleteCongressPersonstarge
  // FetchmeetPreparegetCongressPersonListtwo,
  // FetchmeetPreparegetAgendaPersonListtwo,
  // FetchmeetPreparefindAgendaTreetwo

} from "../../../../../actions/meetPrepareJoinMeetPeople.action"
// import { Table, Icon, Switch, Radio, Form, Divider } from 'antd';
import { ToastsContainer, ToastsStore, ToastsContainerPosition } from 'react-toasts';

const { SubMenu } = Menu;
const styles = theme => ({
  middingPadding: {
    padding: '10px',
    height: window.screen.availHeight * 0.7,
    // overflowY:"scroll",
    width: '100%'
  },
  TitleDiv: {
    'padding': '8px',
    fontSize: '16px',
    fontWeight: '700'
  },
  cardT: {
    maxHeight: window.screen.availHeight * 0.3,
    minHeight: window.screen.availHeight * 0.3,
    overflowY: "auto",
    width: '100%',
  },
  cardB: {
    maxHeight: window.screen.availHeight * 0.3,
    minHeight: window.screen.availHeight * 0.3,
    overflowY: "auto",
    width: '100%',
  },
  cardBT: {
    maxHeight: window.screen.availHeight * 0.55,
    minHeight: window.screen.availHeight * 0.55,
    overflowY: "auto",
    width: '100%',
  },
  middleButton: {
    display: 'flex',

    alignContent: 'center',
    height: window.screen.availHeight * 0.6
  },
  middleButtonmiddleButton: {
    display: 'flex',
    justifyContent: 'center',
    margin: '10px'

  },

})
class AlertDialog extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      // open: false,
      selectedValue: 'b',
      namestate: '',
      current_left: '1',
      current_right: '1',
      treedata: [],
      selectedRowKeys: [],
      selectedRowKeys1: [],
      selectedRowKeys2: [],
      tabledata1: [],
      // loading:false,
      loading1: false,
      loading2: false,
      ClickType: '',
      ClickTypeRight: '',
      LeftIdsSource1: [],
      LeftIdsSource2: [],
      LeftIdsSource3: [],
      tabledata2: [],
      loadingleftstaff: false,
      tabledataleftSourse: [],
      tabledataleftSourse1_right: [],

    };
  }
  componentDidMount() {
    this.props.FetchmeetPreparefindAgendaTree()
    // this.props.FetchmeetPreparefindAgendaTreetwo()
    // this.props.FetchgetStaffInfoListpeople('')
  }
  static getDerivedStateFromProps(props, state) {

    // if(props.meetPreparefindAgendaTree)


    if (state.tabledata2 !== props.getStaffInfoListpeople) {

      // this.lastPage()
      return {
        loadingleftstaff: false,
        tabledata2: props.getStaffInfoListpeople
      }
    }
    return null;
  }


  handleInputChange = (e, type) => {
    switch (type) {
      case "radio":
        this.setState({
          selectedValue: e.target.value,

          // num_error:false,
          // num_error_label:''
        }, () => {
          console.log("999999" + this.state.selectedValue)
          if (this.state.selectedValue == 'a') {
            this.setState({
              loadingleftstaff: true,
              //优化处理
              // tabledataleftSourse:[],
              // current: '1',
            }, () => {
              this.props.FetchgetStaffInfoListpeople()

            })

          }
        })

        break;
      case "namestate":
        this.setState({
          namestate: e.target.value,
          // num_error:false,
          // num_error_label:''
        }, () => {

        })

        break;
      default:
        alert('输入不匹配')
    }
  }
  handleClick_left = e => {
    console.log('click ', e);
    this.setState({
      current_left: e.key,
    });
  };
  handleClick_right = e => {
    console.log('click ', e);
    this.setState({
      current_right: e.key,
    });
  };
  onTitleClick2_left = (e, obj) => {
    console.log('clickeeee', e);
    console.log('click objobjobjobj22222', obj);
    this.setState({
      // ClickType:obj.attributes.type
      ClickType: obj
    })
    if (obj.attributes.type == 'meet') {

      this.setState({
        loading1: true
      }, () => {
        this.props.FetchmeetPreparegetCongressPersonList(obj.id).then(() => {
          this.setState({
            loading1: false,
            tabledataleftSourse: this.props.meetPreparegetCongressPersonList
          })
        })


      })
    } else if (obj.attributes.type == "agenda") {

      this.setState({
        loading1: true
      }, () => {
        this.props.FetchmeetPreparegetAgendaPersonList(obj.id).then(() => {
          this.setState({
            loading1: false,
            tabledataleftSourse: this.props.meetPreparegetAgendaPersonList
          })
        })

      })
    }
  }
  onTitleClick3_right = (e, obj) => {
    console.log('clickeeee', e);
    console.log('click objobjobjobj22222', obj);
    this.setState({
      // ClickTypeRight:obj.attributes.type
      ClickTypeRight: obj
    })

    if (obj.attributes.type == 'meet') {

      this.setState({
        loading2: true
      }, () => {
        this.props.FetchmeetPreparegetCongressPersonList(obj.id).then(() => {
          this.setState({
            loading2: false,
            tabledataleftSourse1_right: this.props.meetPreparegetCongressPersonList
          })
        })


      })
    } else if (obj.attributes.type == "agenda") {

      this.setState({
        loading2: true
      }, () => {
        this.props.FetchmeetPreparegetAgendaPersonList(obj.id).then(() => {
          this.setState({
            loading2: false,
            tabledataleftSourse1_right: this.props.meetPreparegetAgendaPersonList
          })
        })

      })
    }

  }
  formSubmenusChildleft = (obj) => {
    let cHtml = <div></div>;
    let childArray = obj.children;
    if ("undefined" != typeof (childArray) && childArray.length > 0) {
      cHtml = childArray.map((item, i) => {
        return this.formSubmenusChildleft(item);
      });
      return <SubMenu key={obj.id} title={obj.text} onTitleClick={(event) => this.onTitleClick2_left(event, obj)}>
        {/* {this.chooseIcon(obj.parentID)} */}
        {cHtml}</SubMenu>
    } else {
      return <Menu.Item
        // routeurl={obj.routeurl} 
        onClick={(event) => this.onTitleClick2_left(event, obj)}
        // key={obj.id}><span>{this.chooseIcon(obj.parentID)}{obj.name}</span></Menu.Item>
        key={obj.id}><span>{obj.text}</span></Menu.Item>
    }
  }
  formSubmenusChildRight = (obj) => {
    let cHtml = <div></div>;
    let childArray = obj.children;
    if ("undefined" != typeof (childArray) && childArray.length > 0) {
      cHtml = childArray.map((item, i) => {
        return this.formSubmenusChildRight(item);
      });
      return <SubMenu key={obj.id} title={obj.text} onTitleClick={(event) => this.onTitleClick3_right(event, obj)}>
        {/* {this.chooseIcon(obj.parentID)} */}
        {cHtml}</SubMenu>
    } else {
      return <Menu.Item
        // routeurl={obj.routeurl} 
        onClick={(event) => this.onTitleClick3_right(event, obj)}
        // key={obj.id}><span>{this.chooseIcon(obj.parentID)}{obj.name}</span></Menu.Item>
        key={obj.id}><span>{obj.text}</span></Menu.Item>
    }
  }
  prepareDeletedDevIds1 = (Ids) => {
    this.setState({
      LeftIdsSource1: Ids
    }, () => {
      console.log("999991" + this.state.LeftIdsSource1)
    }

    )

  }
  prepareDeletedDevIds2 = (Ids) => {
    this.setState({
      LeftIdsSource2: Ids
    }, () => {
      console.log("999992" + this.state.LeftIdsSource2)
    }

    )

  }
  prepareDeletedDevIds3 = (Ids) => {
    this.setState({
      LeftIdsSource3: Ids
    }, () => {
      console.log("999993" + this.state.LeftIdsSource3)
    }

    )

  }
  Search = () => {

    this.setState({
      loadingleftstaff: true
    }, () => {
      this.props.FetchgetStaffInfoListpeople(this.state.namestate)
    })

  }
  renderMenuleft = () => {
    // let html = this.state.treedata.map((obj, i)=>{
    let html = this.props.meetPreparefindAgendaTree.map((obj, i) => {

      if ("undefined" != typeof (obj.children) && obj.children.length > 0) {
        return this.formSubmenusChildleft(obj);
      } else {

        return <Menu.Item
          onClick={(event) => this.onTitleClick2_left(event, obj)}
          // routeurl={obj.routeurl} 
          key={obj.id}><span>
            {/* {this.chooseIcon(obj.parentID)} */}
            {obj.text}</span></Menu.Item>
      }
    })

    return html
  }
  renderMenuRight = () => {
    // let html = this.state.treedata.map((obj, i)=>{
    let html = this.props.meetPreparefindAgendaTree.map((obj, i) => {

      if ("undefined" != typeof (obj.children) && obj.children.length > 0) {
        return this.formSubmenusChildRight(obj);
      } else {

        return <Menu.Item
          onClick={(event) => this.onTitleClick3_right(event, obj)}
          // routeurl={obj.routeurl} 
          key={obj.id}><span>
            {/* {this.chooseIcon(obj.parentID)} */}
            {obj.text}</span></Menu.Item>
      }
    })

    return html
  }
  addmeetPeopleTO = () => {

    if (this.state.selectedValue == 'a') {
      //基础人员

      if (this.state.LeftIdsSource3.length > 0) {

        if (this.state.ClickTypeRight !== '') {

          if (this.state.ClickTypeRight.attributes.type == 'meet') {

            // FetchaddCongressPersonsListtarge
            let staffInfo = {
              'persons': this.state.LeftIdsSource3.toString(),
              'congressID': this.state.ClickTypeRight.id,
              'typeId': 'jcry'

            }
            this.props.FetchaddCongressPersonsListtarge(staffInfo).then(() => {


              this.setState({
                loading2: true
              }, () => {
                this.props.FetchmeetPreparegetCongressPersonList(this.state.ClickTypeRight.id).then(() => {
                  this.setState({
                    loading2: false,
                    tabledataleftSourse1_right: this.props.meetPreparegetCongressPersonList
                  })
                  ToastsStore.success(this.props.addCongressPersonsListtarge)
                  if (this.state.ClickType && this.state.ClickType.attributes.type == 'meet') {
                    if (this.state.ClickType.id == this.state.ClickTypeRight.id) {
                      this.setState({
                        tabledataleftSourse: this.props.meetPreparegetCongressPersonList
                      })
                    }
                  }
                })


              })
            })
          } else if (this.state.ClickTypeRight.attributes.type == 'agenda') {
            // FetchaddCongressPersonsListtarge
            let staffInfo = {
              'persons': this.state.LeftIdsSource3.toString(),
              'agendaID': this.state.ClickTypeRight.id,
              'typeId': 'jcry'

            }
            this.props.FetchaddAgendaPersonsListtarge(staffInfo).then(() => {


              this.setState({
                loading2: true
              }, () => {
                this.props.FetchmeetPreparegetAgendaPersonList(this.state.ClickTypeRight.id).then(() => {
                  this.setState({
                    loading2: false,
                    tabledataleftSourse1_right: this.props.meetPreparegetAgendaPersonList
                  })
                  ToastsStore.success(this.props.addAgendaPersonsListtarge)
                  if (this.state.ClickType.attributes && this.state.ClickType.attributes.type == 'agenda') {
                    if (this.state.ClickType.id == this.state.ClickTypeRight.id) {
                      this.setState({
                        tabledataleftSourse: this.props.meetPreparegetAgendaPersonList
                      })
                    }
                  }
                })


              })
            })
          }
        } else {
          ToastsStore.error("请选择目标会议")
        }
      } else {
        ToastsStore.error("请选择基础人员")
      }
    } 
    else if (this.state.selectedValue == 'b') {
      //源会议

      if (this.state.LeftIdsSource1.length > 0) {

        if (this.state.ClickType !== '') {
          if (this.state.ClickType.attributes.type == 'meet') {
            if (this.state.ClickTypeRight !== '') {
              if (this.state.ClickTypeRight.attributes.type == 'meet') {

                // FetchaddCongressPersonsListtarge
                let staffInfo = {
                  'persons': this.state.LeftIdsSource1.toString(),
                  'congressID': this.state.ClickTypeRight.id,
                  'typeId': 'yhy'

                }
                this.props.FetchaddCongressPersonsListtarge(staffInfo).then(() => {


                  this.setState({
                    loading2: true
                  }, () => {
                    this.props.FetchmeetPreparegetCongressPersonList(this.state.ClickTypeRight.id).then(() => {
                      this.setState({
                        loading2: false,
                        tabledataleftSourse1_right: this.props.meetPreparegetCongressPersonList
                      })

                      ToastsStore.success(this.props.addCongressPersonsListtarge)
                    })


                  })
                })
              } else {
                ToastsStore.error("请选择目标会议")
              }
            } else {
              ToastsStore.error("请选择目标会议")
            }

          }
          else if (this.state.ClickType.attributes.type == 'agenda') {
            if (this.state.ClickTypeRight !== '') {
              if (this.state.ClickTypeRight.attributes.type == 'agenda') {
                // FetchaddCongressPersonsListtarge
                let staffInfo = {
                  'persons': this.state.LeftIdsSource1.toString(),
                  'agendaID': this.state.ClickTypeRight.id,
                  'typeId': 'yhy'

                }
                this.props.FetchaddAgendaPersonsListtarge(staffInfo).then(() => {


                  this.setState({
                    loading2: true
                  }, () => {
                    this.props.FetchmeetPreparegetAgendaPersonList(this.state.ClickTypeRight.id).then(() => {
                      this.setState({
                        loading2: false,
                        tabledataleftSourse1_right: this.props.meetPreparegetAgendaPersonList
                      })
                      ToastsStore.success(this.props.addAgendaPersonsListtarge)
                    })


                  })
                })
              } else {
                ToastsStore.error("请选择目标议程")
              }
            } else {
              ToastsStore.error("请选择目标议程")
            }
          }
        } else {
          ToastsStore.error("请选择目标议程")
        }
      } else {
        ToastsStore.error("请选择源会议参会人员")
      }
    }
  }
  DeletemeetPeopleTO = () => {
    if (this.state.LeftIdsSource2.length > 0) {
      if (this.state.ClickTypeRight !== '') {
        if (this.state.ClickTypeRight.attributes.type == 'meet') {
          // FetchaddCongressPersonsListtarge
          //  let staffInfo={
          //   'persons':this.state.LeftIdsSource2.toString(),
          //    }
          this.props.FetchdeleteCongressPersonstarge(this.state.LeftIdsSource2.toString()).then(() => {
            this.setState({
              loading2: true
            }, () => {
              this.props.FetchmeetPreparegetCongressPersonList(this.state.ClickTypeRight.id).then(() => {
                this.setState({
                  loading2: false,
                  tabledataleftSourse1_right: this.props.meetPreparegetCongressPersonList
                })
                if (this.state.ClickType.attributes.type == 'meet') {
                  if (this.state.ClickType.id == this.state.ClickTypeRight.id) {
                    this.setState({
                      tabledataleftSourse: this.props.meetPreparegetCongressPersonList
                    })
                  }
                }

                //  ToastsStore.success(this.props.addCongressPersonsListtarge)
              })


            })
          })

        }
        else if (this.state.ClickTypeRight.attributes.type == 'agenda') {
          // let staffInfo={
          //   'persons':this.state.LeftIdsSource2.toString(),
          //  }
          this.props.FetchdeleteAgendaPersonstarge(this.state.LeftIdsSource2.toString()).then(() => {
            this.setState({
              loading2: true
            }, () => {
              this.props.FetchmeetPreparegetAgendaPersonList(this.state.ClickTypeRight.id).then(() => {
                this.setState({
                  loading2: false,
                  tabledataleftSourse1_right: this.props.meetPreparegetAgendaPersonList
                })
                if (this.state.ClickType.attributes.type == 'agenda') {
                  if (this.state.ClickType.id == this.state.ClickTypeRight.id) {
                    this.setState({
                      tabledataleftSourse: this.props.meetPreparegetAgendaPersonList
                    })
                  }
                }
                //  ToastsStore.success(this.props.addCongressPersonsListtarge)
              })


            })
          })
        }
      } else {
        ToastsStore.error("请选择需要移除的目标会议或议程")
      }

    } else {
      ToastsStore.error("请选择需要移除的目标会议或议程")
    }
  }
  render() {
    // console.log('数据6shu'+JSON.stringify(this.state.treedata) )
    const { classes } = this.props
    const { selectedRowKeys, selectedRowKeys1, selectedRowKeys2 } = this.state
    const rowSelection = {
      selectedRowKeys,

      onChange: (selectedRowKeys, selectedRows) => {

        this.prepareDeletedDevIds1(selectedRowKeys);
        this.setState({ selectedRowKeys });
        console.log(
          `selectedRowKeys: ${selectedRowKeys}`,
          "selectedRows: ",
          selectedRows
        );
      },
      onSelect: (record, selected, selectedRows) => {
        console.log("左表格onSelect" + record, selected, selectedRows);
        //   this.preparedeletePartitionTableIds( selectedRows)
      },
      onSelectAll: (selected, selectedRows, changeRows) => {
        console.log("左表格onSelectAll" + selected, selectedRows, changeRows);
        //   this.preparedeletePartitionTableIds( selectedRows)
      },
    }
    const rowSelection2 = {
      selectedRowKeys2,

      onChange: (selectedRowKeys2, selectedRows) => {

        this.prepareDeletedDevIds2(selectedRowKeys2);
        this.setState({ selectedRowKeys2 });
        console.log(
          `selectedRowKeys2: ${selectedRowKeys2}`,
          "selectedRows: ",
          selectedRows
        );
      },
      onSelect: (record, selected, selectedRows) => {
        console.log("右表格onSelect" + record, selected, selectedRows);
        //   this.preparedeletePartitionTableIds( selectedRows)
      },
      onSelectAll: (selected, selectedRows, changeRows) => {
        console.log("右表格onSelectAll" + selected, selectedRows, changeRows);
        //   this.preparedeletePartitionTableIds( selectedRows)
      },
    }


    const rowSelection1 = {
      selectedRowKeys1,

      onChange: (selectedRowKeys1, selectedRows) => {

        this.prepareDeletedDevIds3(selectedRowKeys1);
        this.setState({ selectedRowKeys1 });
        console.log(
          `selectedRowKeys1: ${selectedRowKeys1}`,
          "selectedRows: ",
          selectedRows
        );
      },
      onSelect: (record, selected, selectedRows) => {
        console.log("基础人员选择onSelect" + record, selected, selectedRows);
        //   this.preparedeletePartitionTableIds( selectedRows)
      },
      onSelectAll: (selected, selectedRows, changeRows) => {
        console.log("基础人员选择onSelectAll" + selected, selectedRows, changeRows);
        //   this.preparedeletePartitionTableIds( selectedRows)
      },
    }
    const columns1 = [



      {
        title: 'id',
        dataIndex: 'id',
        width: '50px',
        // fixed: 'left',

      }, {
        title: '编号',
        dataIndex: 'num',
        width: '50px',
      },
      {
        title: '姓名',
        dataIndex: 'name',
        width: '50px',
      },
      {
        title: '工作单位',
        dataIndex: 'workUnit',
        width: '100px',
      },
      {
        title: '人员类型',
        dataIndex: 'categoryName',
        width: '100px',
      },
      {
        title: '团组',
        dataIndex: 'groupName',
        width: '50px',
        fixed: 'right',
      },
    ]




    return (
      <div >

        <Dialog
          open={this.props.SynDataDialogOpen}
          onClose={this.props.SynDataDialogclose}
          aria-labelledby="alert-dialog-title"
          fullWidth={true}
          maxWidth='md'
        >
          {      // <DialogTitle id="alert-dialog-title">
            // {'同步数据'}
            // </DialogTitle>
          }
          <div className={classes.TitleDiv} >
            {'同步数据!'}
            {/* 鼠标点选会议级别下 有议程的节点（这时下面会显示该议程下的人员），
          这个时候就可以向对面的 会议级别下有议程的节点增加选中的人员
          编辑人员
          提交图片，保存时必须选择人员状态
 */}
          </div>

          <Grid container spacing={0} className={classes.middingPadding} >
            {/* left part */}
            <Grid item xs={5}>
              <Grid container spacing={0}  >
                <Grid item xs={4}>
                  数据来源：
                </Grid>
                <Grid item xs={8}>
                  <Radio
                    checked={this.state.selectedValue === 'a'}
                    onChange={(event) => this.handleInputChange(event, 'radio')}
                    value="a"
                    name="radio-button-demo"
                    style={{ height: "30px" }}
                    aria-label="A"
                  />
                  <Radio
                    checked={this.state.selectedValue === 'b'}
                    onChange={(event) => this.handleInputChange(event, 'radio')}
                    value="b"
                    name="radio-button-demo"
                    style={{ height: "30px" }}
                    aria-label="B"
                  />
                </Grid>
                {
                  //源会议显示
                }
                < Grid item xs={12} style={{ display: (this.state.selectedValue === 'b' ? 'block' : 'none') }}  >
                  <Grid container spacing={0} >

                    <Grid item xs={12} >
                      <Card className={classes.cardT}>
                        <CardContent>

                          <Menu

                            onClick={this.handleClick_left}
                            style={{ width: '100% ', 'border-right': '0' }}
                            defaultOpenKeys={['sub1']}
                            selectedKeys={[this.state.current_left]}
                            mode="inline"  >
                            {
                              // this.state.treedata && this.state.treedata.length>0 && this.renderMenuleft()
                              this.props.meetPreparefindAgendaTree && this.props.meetPreparefindAgendaTree.length > 0 && this.renderMenuleft()
                            }

                          </Menu>

                        </CardContent>
                      </Card>
                    </Grid>

                    <Grid item xs={12} >
                      <Card className={classes.cardB}>
                        <CardContent>
                          <Table
                            loading={this.state.loading1}
                            rowSelection={rowSelection}
                            bordered
                            size="small"
                            // scroll={{x:  'calc(800px+50%)' ,  y:'120px'}}
                            scroll={{ x: 'calc(800px+50%)', y: '100%' }}
                            pagination={false}
                            columns={columns}
                            // columns={columns}
                            // dataSource={this.state.tabledata1  }
                            dataSource={this.state.tabledataleftSourse}
                            rowKey={record => record.id}
                          // style ={{marginBottom :'10px',width:'100%'}}
                          />

                        </CardContent>
                      </Card>
                    </Grid>


                  </ Grid>
                </ Grid>

                {
                  //基础人员
                }
                < Grid item xs={12} style={{ display: (this.state.selectedValue === 'a' ? 'block' : 'none') }}>
                  <Grid container spacing={0}  >

                    <Grid item xs={4} >
                      人员名称
                    </Grid>
                    <Grid item xs={6} >
                      <TextField

                        className="mytextfield"
                        fullWidth
                        margin="normal"
                        variant="outlined"
                        //  type="number"
                        InputLabelProps={{
                          shrink: true,
                        }}

                        onChange={(event) => this.handleInputChange(event, 'namestate')}

                      />
                    </Grid>
                    <Grid item xs={2}  >
                      <Button variant='contained' style={{ height: '25px', padding: '2px' }} onClick={() => this.Search()}>查询</Button>

                    </Grid>
                    <Grid item xs={12} >
                      <Card className={classes.cardBT}>
                        <CardContent >
                          <Table
                            loading={this.state.loadingleftstaff}
                            rowSelection={rowSelection1}
                            bordered
                            size="small"
                            // scroll={{x:  'calc(800px+50%)' ,  y:'120px'}}
                            scroll={{ x: 'calc(600px+50%)', y: '100%' }}
                            pagination={false}
                            columns={columns1}
                            // columns={columns}
                            dataSource={this.state.tabledata2}
                            // dataSource={this.props.getStaffInfoListpeople?this.props.getStaffInfoListpeople:'' }
                            rowKey={record => record.id}
                          // style ={{marginBottom :'10px',width:'100%'}}
                          />

                        </CardContent>
                      </Card>
                    </Grid>
                  </Grid>
                </Grid>





              </Grid>
            </ Grid>

            <Grid item xs={2}  >
              <Grid container spacing={0} >
                <Grid item xs={12} style={{ height: '12px' }}>

                </Grid>
              </Grid>
              <Grid container spacing={0} className={classes.middleButton}>
                {    //   <Grid  item xs={12}   className={classes.middleButtonmiddleButton}>
                  //   <Button  variant ='contained' onClick={

                  //   }>
                  //   增加全部
                  //   </Button>

                  // </Grid> 
                }
                <Grid item xs={12} className={classes.middleButtonmiddleButton} >
                  <Button variant='contained' onClick={() => this.addmeetPeopleTO()}>
                    增加选中
                  </Button>
                </Grid>
                <Grid item xs={12} className={classes.middleButtonmiddleButton}>
                  <Button variant='contained' onClick={() => this.DeletemeetPeopleTO()}>
                    移除选中
                  </Button>
                </Grid>
                {  // <Grid  item xs={12}  className={classes.middleButtonmiddleButton} >
                  //   <Button  variant ='contained'>
                  //   移除选中
                  //   </Button>
                  //  </Grid> 
                }

              </Grid>
            </Grid>
            {/* right part */}
            <Grid item xs={5}>
              <Grid container spacing={0}   >

                <Grid item xs={12}>
                  目标数据：
                </Grid>

                {
                  //源会议显示
                }
                < Grid item xs={12}   >
                  <Grid container spacing={0} >

                    <Grid item xs={12} >
                      <Card className={classes.cardT}>
                        <CardContent>

                          <Menu

                            onClick={this.handleClick_right}
                            style={{ width: '100% ', 'border-right': '0' }}
                            defaultOpenKeys={['sub1']}
                            selectedKeys={[this.state.current_right]}
                            mode="inline"  >
                            {
                              // this.state.treedata && this.state.treedata.length>0 && this.renderMenuleft()
                              this.props.meetPreparefindAgendaTree && this.props.meetPreparefindAgendaTree.length > 0 && this.renderMenuRight()
                            }

                          </Menu>
                        </CardContent>
                      </Card>
                    </Grid>

                    <Grid item xs={12} >
                      <Card className={classes.cardB}>
                        <CardContent>
                          <Table
                            loading={this.state.loading2}
                            rowSelection={rowSelection2}
                            bordered
                            size="small"
                            // scroll={{x:  'calc(800px+50%)' ,  y:'120px'}}
                            scroll={{ x: 'calc(800px+50%)', y: '100%' }}
                            pagination={false}
                            columns={columns}
                            // columns={columns}
                            dataSource={this.state.tabledataleftSourse1_right}
                            rowKey={record => record.id}
                          // style ={{marginBottom :'10px',width:'100%'}}
                          />


                        </CardContent>
                      </Card>
                    </Grid>


                  </ Grid>
                </ Grid>

              </Grid>
            </Grid>
          </Grid>







          <DialogActions>
            <Button onClick={this.props.SynDataDialogclose} color="primary">
              不同意
            </Button>
            <Button onClick={this.props.SynDataDialogclose} color="primary" autoFocus>
              同意
            </Button>
          </DialogActions>
        </Dialog>
      </div>
    );
  }




}
function mapStateToProps(state) {
  return {
    // meetPreparegetfindAgendaPersonByID:  state.meetPrepareJoinMeetPeopleReducer.meetPreparegetfindAgendaPersonByID ,
    meetPreparefindAgendaTree: state.meetPrepareJoinMeetPeopleReducer.meetPreparefindAgendaTree,
    meetPreparegetAgendaPersonList: state.meetPrepareJoinMeetPeopleReducer.meetPreparegetAgendaPersonList,
    meetPreparegetCongressPersonList: state.meetPrepareJoinMeetPeopleReducer.meetPreparegetCongressPersonList,
    getStaffInfoListpeople: state.meetPrepareJoinMeetPeopleReducer.getStaffInfoListpeople,
    addCongressPersonsListtarge: state.meetPrepareJoinMeetPeopleReducer.addCongressPersonsListtarge,
    addAgendaPersonsListtarge: state.meetPrepareJoinMeetPeopleReducer.addAgendaPersonsListtarge,
    // meetPreparegetAgendaPersonListTwo:state.meetPrepareJoinMeetPeopleReducer.meetPreparegetAgendaPersonListTwo,
    // meetPreparegetCongressPersonListTwo:state.meetPrepareJoinMeetPeopleReducer.meetPreparegetCongressPersonListTwo,
    // meetPreparefindAgendaTreeTwo:state.meetPrepareJoinMeetPeopleReducer.meetPreparefindAgendaTreeTwo,
  }
}
function mapDispatchToProps(dispatch) {
  return {
    // meetPreparegetfindAgendaPersonByID:  state.meetPrepareJoinMeetPeopleReducer.meetPreparegetfindAgendaPersonByID ,
    // FetchmeetPreparegetAgendaPersonList: bindActionCreators( FetchmeetPreparegetAgendaPersonList, dispatch),
    FetchmeetPreparefindAgendaTree: bindActionCreators(FetchmeetPreparefindAgendaTree, dispatch),
    FetchmeetPreparegetAgendaPersonList: bindActionCreators(FetchmeetPreparegetAgendaPersonList, dispatch),
    FetchmeetPreparegetCongressPersonList: bindActionCreators(FetchmeetPreparegetCongressPersonList, dispatch),
    FetchgetStaffInfoListpeople: bindActionCreators(FetchgetStaffInfoListpeople, dispatch),
    FetchaddCongressPersonsListtarge: bindActionCreators(FetchaddCongressPersonsListtarge, dispatch),
    FetchaddAgendaPersonsListtarge: bindActionCreators(FetchaddAgendaPersonsListtarge, dispatch),
    FetchdeleteAgendaPersonstarge: bindActionCreators(FetchdeleteAgendaPersonstarge, dispatch),
    FetchdeleteCongressPersonstarge: bindActionCreators(FetchdeleteCongressPersonstarge, dispatch),
    // FetchmeetPreparegetCongressPersonListtwo: bindActionCreators( FetchmeetPreparegetCongressPersonListtwo, dispatch),
    // FetchmeetPreparegetAgendaPersonListtwo: bindActionCreators( FetchmeetPreparegetAgendaPersonListtwo, dispatch),
    // FetchmeetPreparefindAgendaTreetwo: bindActionCreators( FetchmeetPreparefindAgendaTreetwo, dispatch),

  }
}

export default withStyles(styles, { withTheme: true })(connect(mapStateToProps, mapDispatchToProps)(AlertDialog));